package offer;

public class offer_0063 {
    public int maxProfit(int[] prices) {
        int len=prices.length;
        if(len==0) return 0;
        int min=prices[0];
        int max=0;
        for(int i=0;i<len;++i){
            min=Math.min(min,prices[i]);
            max=Math.max(max,prices[i]-min);
        }
        return max;
    }
}
